﻿namespace Agile.Shared.Application.Contracts;

/// <summary>
/// 响应结果类
/// </summary>
/// <typeparam name="T"></typeparam>
[Serializable]
public sealed class ResponseResult<T>
{
    /// <summary>状态码</summary>
    public ResponseStatus Status { get; set; } = ResponseStatus.Code200;

    /// <summary>操作是否成功</summary>
    public bool Success { get; set; } = false;

    /// <summary>返回信息</summary>
    public string Message { get; set; } = string.Empty;

    /// <summary>返回数据集合</summary>
    public T? Result { get; set; }
}

public enum ResponseStatus
{
    /// <summary>业务处理成功</summary>
    Code200 = 200,
    /// <summary>业务处理失败</summary>
    Code400 = 400,
    /// <summary>认证（鉴权）失败（表示没有登录）</summary>
    Code401 = 401,
    /// <summary>账号需要先修改密码才能使用</summary>
    Code402 = 402,
    /// <summary>授权失败（表示没有权限）</summary>
    Code403 = 403,
    /// <summary>请求的资源不存在</summary>
    Code404 = 404,
    /// <summary>服务器内部异常（指未处理的异常）</summary>
    Code500 = 500,
}